#ifndef TOWERITEM_H
#define TOWERITEM_H

#include <QtCore>
#include <QtGui>
#include "unititem.h"

class TowerItem : public QGraphicsItem
{
    Q_ENUMS(EnumFocusOn)

    struct TowerProperties
    {
        qreal   radius;
        qreal   speed;
        qreal   power;
        int     amountUnitsCanBeFocused;
        UnitTypes   targetUnitsTypes;
    };

public:
    enum EnumFocusOn {First, Last, Strong, Weak, Accumulation};

    TowerItem();
    TowerItem(qreal x, qreal y);
    inline void setProperties(QList<TowerProperties>& value) {m_properties = value;}

    inline qreal radius(int level) const { if (level >= m_properties.count()) return 0.0; return m_properties.at(level).radius; }
    inline qreal speed(int level) const { if (level >= m_properties.count()) return 0.0; return m_properties.at(level).speed; }
    inline qreal power(int level) const { if (level >= m_properties.count()) return 0.0; return m_properties.at(level).power; }
    inline UnitTypes unitTypes(int level) const { if (level >= m_properties.count()) return 0; return m_properties.at(level).targetUnitsTypes; }
    inline int amountUnitsCanBeFocused(int level) const { if (level >= m_properties.count()) return 0; return m_properties.at(level).amountUnitsCanBeFocused; }

    inline EnumFocusOn focusOn() const {return m_focusOn;}
    inline void setFocusOn(EnumFocusOn value) { m_focusOn = value; }

    virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0) = 0;
    virtual QRectF boundingRect() const = 0;
private:
    QList<TowerProperties> m_properties;
    qreal       m_x, m_y;
    EnumFocusOn m_focusOn;
};

#endif // TOWERITEM_H
